﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace ConfExpert.EOS
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        public string ConnectionString;

     

        private void button1_Click(object sender, EventArgs e)
        {
            string ServerAddress = "confexpert.karbel.com";
            if (chkIsInLocalNetwork.Checked && txtUserName.Text != "kasim.gulcan")
                ServerAddress = "10.0.0.4";

            /*
            ceGate.ceGateSoapClient gate = new ceGate.ceGateSoapClient();
            gate.Endpoint.Address = new System.ServiceModel.EndpointAddress(string.Format("http://{0}/ceGate/ceGate.asmx", ServerAddress));

            SqlConnectionStringBuilder cnnStrBuilder = new SqlConnectionStringBuilder();
            DataSet dsCredentials = null;
            try
            {
                dsCredentials = gate.GetCredentials(txtUserName.Text, txtPassword.Text, ServerAddress, "");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Sistem Hatası ! [ConfExpert Gate]:" + ex.ToString());                 
            }

            if (dsCredentials == null)
                txtPassword.Text = "";

            string connectionString = dsCredentials.Tables["ConnectionString"].Rows[0]["ConnectionString"].ToString();
            cnnStrBuilder.ConnectionString = connectionString;

            ConnectionString = cnnStrBuilder.ConnectionString;




            */
            ConnectionString = @"Data Source=.;Initial Catalog=Photo;Integrated Security=True";
            this.DialogResult = DialogResult.OK;
        }

        private void Login_Load(object sender, EventArgs e)
        {
            button1.PerformClick();
        }
    }
}
